/*
encoder 例子
*/
#include "bsp_encoder.h"
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    pthread_t enc_thd;  //定义线程ID变量，而不是指针
    int ret;

    // 创建编码器线程
    ret = pthread_create(&enc_thd, NULL, encoder_thd1, NULL);
    if (ret != 0) {
        fprintf(stderr, "Failed to create encoder thread: %s\n", strerror(ret));
        return -1;
    }

    printf("Encoder thread started (ID: %lu)\n", (unsigned long)enc_thd);

    // 等待线程结束
    ret = pthread_join(enc_thd, NULL);
    if (ret != 0) {
        fprintf(stderr, "Failed to join encoder thread: %s\n", strerror(ret));
        return -1;
    }

    printf("Encoder thread completed\n");
    return 0;
}